<?
        /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */

    /*********************************************************
    *            --== InArch ==--
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 30.04.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/
    
    /***
    * Class translitWrap
    ****
    * This is a wrapper for a third party library TranslitURL, which
    * creates valid URLs out of strings
    ****
    * @package service
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 30.04.2005
    * @copyright essentialmind.com 2005
    ***/
    class translitWrap{
        
        /**
         * Parser for the data, actual external library
         *
         * @var Translit
         */
        private $translit;
        
        /**
         * El Constructor
         *
         */
        public function __construct(){
            //get the libraries
            require_once INA_ROOT . 'lib' . DIRECTORY_SEPARATOR . 'translit' . DIRECTORY_SEPARATOR . 'translit.php';  
            
            //create the parser
            $this->translit = new Translit();
        }
        
        
        /**
         * This function places a call to the parser, which will create a valid URI out
         * of whatever inputs it gets
         *
         * @param string $data
         * @return string
         */
        public function UrlTranslit($data){
            if($GLOBALS['_CONFIG']['lang_cl'] == 'rus'){
                $dest = 'CP1251';
            }else{
                $dest = 'CP1250';
            }
            //$data = iconv("UTF-8",$dest,$data);
            //$data = strtolower($data);
            //echo $data; exit;
            return $this->translit->UrlTranslit(iconv("UTF-8",$dest,$data));
        }
    }
?>